/*******************************************************************************
 * Copyright (c) 2010 L.Carbonnaux.
 *******************************************************************************/

package org.lcx.taskvision.ui;


import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Platform;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.lcx.taskvision.core.TaskVisionCorePlugin;
import org.osgi.framework.BundleContext;


/**
 * @author Laurent Carbonnaux
 */
public class TaskVisionUiPlugin extends AbstractUIPlugin {

	// The plug-in ID
	public static final String PLUGIN_ID = "org.lcx.taskvision.ui";
	

	// The shared instance
	private static TaskVisionUiPlugin plugin;

	// TODO : complete for 3.0
	//private static ScrumVisionTaskStatusManager taskStatusManager;
	
	/**
	 * The constructor
	 */
	public TaskVisionUiPlugin() {
	}

	/*
	 * (non-Javadoc)
	 * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
	 */
	public void start(BundleContext context) throws Exception {
		super.start(context);

		plugin = this;

	}

	/*
	 * (non-Javadoc)
	 * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
	 */
	public void stop(BundleContext context) throws Exception {
		
		// TODO : complete for 3.0
		//ScrumVisionRepositoryConnector svConnector = (ScrumVisionRepositoryConnector) TasksUi.getRepositoryManager()
		//.getRepositoryConnector(ScrumVisionCorePlugin.CONNECTOR_KIND);

		//TasksUi.getRepositoryManager().removeListener(svConnector.getClientManager());
		
		super.stop(context);
		plugin = null;
		
	}

	/**
	 * Returns the path to the file caching the product configuration.
	 */
	static IPath getProductConfigurationCachePath() {
		IPath stateLocation = Platform.getStateLocation(TaskVisionCorePlugin.getDefault().getBundle());
		IPath configFile = stateLocation.append("repositoryConfigurations");
		return configFile;
	}

	/**
	 * Returns the shared instance
	 *
	 * @return the shared instance
	 */
	public static TaskVisionUiPlugin getDefault() {
		return plugin;
	}

	/**
	 * @return the taskStatusManager
	 */
	// TODO : complete for 3.0
	/*
	public static ScrumVisionTaskStatusManager getTaskStatusManager() {
		return taskStatusManager;
	}
	*/
	
}
